*******************************************************************************
* Load and append data sets
*******************************************************************************

use dataset_gallup, clear
append using dataset_anes
append using dataset_gss

*******************************************************************************
* Keep only if non-missing on race subsets
*******************************************************************************

keep if (data == "anes" & !mi(ftBlack)) | ///
	(data == "gallup" & !mi(confidenceBlack)) | ///
	(data == "gss" & !mi(spend_lawenfBlack))

*******************************************************************************
* Figure
*******************************************************************************

foreach y in confidence ft spend_lawenf {
	
	local mytext1 text(0.8 2010 "White Rep")
	local mytext2 text(0.5 2010 "White Dem")
	local mytext3 text(0.27 2010 "Black Dem")

	if "`y'" != "confidence" local mytext1
	if "`y'" != "confidence" local mytext2
	if "`y'" != "confidence" local mytext3

	if "`y'" == "confidence" local mytitle "(a) Confidence (Gallup)"
	if "`y'" == "ft" local mytitle "(b) Feeling thermometer (ANES)"
	if "`y'" == "spend_lawenf" local mytitle "(c) Spending (GSS)"

	#delimit;

	gr tw
		(sc `y'White_Rep year, col(black) msym(th))
		(sc `y'White_Dem year, col(black) msym(Oh) msize(medsmall))
		(sc `y'Black_Dem year, col(black) msym(O) msize(medsmall))
		(lfit `y'White_Rep year, col(black))
		(lfit `y'White_Dem year, col(black) lpat(dash))
		(lfit `y'Black_Dem year, col(black) lpat(shortdash))
		, 	
			ylab(, angle(horiz))
			legend(off)
			plotregion(style(none))
			ytitle("")
			xtitle("")
			xlab(1995(5)2020)
			`mytext1'
			`mytext2'
			`mytext3'
			name(g`y', replace)
			title("`mytitle'")
			;
			
	#delimit cr
	
	gr close

}

gr combine gconfidence gft gspend_lawenf, cols(1) imargin(zero) ///
	ysize(4) xsize(2)

*******************************************************************************
* Export
*******************************************************************************

gr export "_output/figure4.eps", replace

*******************************************************************************
* End
*******************************************************************************
